#pragma once

struct Variable {
	string type;
	string name;
	bool isArray;
	int numIndex;
};

struct TreeNode {
	string type;
	string value;
	TreeNode* parent;
	TreeNode* children[10];
	int childNum;
	int numChildOfParent;
	int stringNum;
	bool isDisabled;
	bool isAssigmnExp;
	Variable operand;
};

class Tree
{
public:
	Tree(void);
	~Tree(void);
	TreeNode* newNode(string type, string value, int stringNum);
	void setNodeConnection(TreeNode* child, TreeNode* parent);
	void setHeadConnection(TreeNode* child);
	void printToFile(string filePath);
	TreeNode* getHeadNode();
	TreeNode* getLastAddNode();
	TreeNode* getLastNodeOfBranch(TreeNode* curNode);

	string getExpStr(TreeNode* head);
	string getHoleExpValue(TreeNode* start);
private:

	TreeNode *headNode;
	TreeNode *lastAddToTree;
	vector<TreeNode> stackNodes;
};
